function twoNums(nums,target){
    // const 
    const diffs=new Map()
    for(let i=0;i<nums.length;i++){
        if(diffs.get(target-nums[i])!==undefined){
            return [diffs.get(target-nums[i]),i]
        }
        diffs.set(nums[i],i)
    }
}
console.log(twoNums([2, 11, 9, 15,7],9));